package vn.kiemviec.app.viewadapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

public abstract class HDiArrayAdapter<E> extends ArrayAdapter<E> {

	public abstract int getItemLayoutRes();
	public abstract void onBindData(int pos,View v);
	
	public HDiArrayAdapter(Context context, ArrayList<E> objects) {
		super(context, 0, objects);
		// TODO Auto-generated constructor stub
		
	}
			
	@Override
	final public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if(convertView == null){
			LayoutInflater inflater = LayoutInflater.from(getContext());
			View v = inflater.inflate(getItemLayoutRes(), null);
			convertView = v;
		}
		
		onBindData(position,convertView);
		return convertView;
	}

}
